
%Set relevant frequency range
range = find(fvector >= 0.095 & fvector <= 0.2);

%Extract relevant data
Data = FTArray(:,range);

%Determine the frequency of the max peak for each frame and compute length
Index = zeros(1,size(Data,1));
for i = 1:size(Data,1)
    
    Index(i) = 1./fvector(find(Data(i,:) == max(Data(i,:)))+range(1)-1);
    
end

%Initialize time vector
t = (0:(length(Index)-1)) / 200;

%Plot legnth v. time
hold off
plot(t,Index)
ylabel(sprintf('Sarcomere Length (pixels)'))
xlabel('Time(s)')
title('Sarcomere Movement')

%{
%Plot consecutive frame difference variance
yyaxis right
plot(t,DifArray(2,:))
ylabel(sprintf('Variancce in Pixel Intensity Differences\nBetween Consecutive Frames'))
xlabel('Time(s)')
title('Sarcomere Movement')
%}
